import '../Include.dart';
import '../widget/GuideView.dart';

class GuidePage extends StatefulWidget {
  @override
  createState() => _GuidePageState();
}

class _GuidePageState extends BasePageState<GuidePage> {
  @override
  bool get isAppBar => false;

  @override
  bool get isDoubleClick => true;

  @override
  StatusBarStyle get statusBarStyle => StatusBarStyle.DARK_CONTENT;

  @override
  Widget buildBody(BuildContext context) {
    return GuideView(
      guideImages: <String>[
        JvtdImage.getGuideImg(1),
        JvtdImage.getGuideImg(2),
        JvtdImage.getGuideImg(3),
      ],
      data: JvtdString.getLocale(context).start_app,
      onPressed: () {
        _toApp();
      },
    );
  }

  //跳转APP
  void _toApp() {
    if (JvtdConfig.IS_MUST_LOGIN) {
      //APP 强制登录  里面需要加是否已有用户操作
      Application.router.navigateTo(
        context,
        Routes.LOGIN_ROUTE_NAME,
        replace: true,
        transitionDuration: JvtdConfig.PAGE_TRANSITION_DURATION,
      );
    } else {
      //无需登录
      Application.router.navigateTo(
        context,
        Routes.MAIN_ROUTE_NAME,
        replace: true,
        transitionDuration: JvtdConfig.PAGE_TRANSITION_DURATION,
      );
    }
  }
}
